package com.yuqian.JavaSe.niuke;

import java.util.*;

public class Different {
    public static boolean checkDifferent(String iniString) {
        // write code here
        char[] all=iniString.toCharArray();
        if(all.length==0){
        	return false;
        }
        for(int i=0;i<all.length-2;i++){
        	for(int j=i+1;j<all.length-1;j++){
        		if(all[i]==all[j]){
        			return false;
        		}
        	}
        }
        return true;
    }
    
    public static void main(String[] args) {
    	//System.out.println(Different.checkDifferent("avseoiuytrwq"));
    	System.out.println(Different.reverseString("i am the king of the world"));
	}
    
    public static String reverseString(String iniString) {
    	 char[] all=iniString.toCharArray();
    	 if(all.length==0){
         	return iniString;
         }
    	 for(int i=0;i<all.length/2;i++){
    		 char swap =all[i];
    		 all[i]=all[all.length-i-1];
    		 all[all.length-i-1]=swap;
    	 }
    	 return new String(all);
    }
}